package com.tumblr.logico2012.screens;

import processing.core.PApplet;
import processing.core.PFont;

import com.tumblr.logico2012.gestures.GestureManager;
import static com.tumblr.logico2012.AppletLogico.DISABLE_CAMERA;

/**
 * First screen. The interface IScreen is not completely implemented: the
 * method leave is implemented in AppletLogico.StartScreen.
 */
public abstract class IStartScreen implements IScreen {
	protected PApplet p;

	// COLOURS
	int clBackground;
	int clForeground;

	// FONTS
	PFont fBanner;
	PFont fHeader;

	public IStartScreen(PApplet processor) {
		p = processor;

		clBackground = p.color(230, 220, 210);
		clForeground = p.color(30, 20, 10);
		fBanner = p.createFont("Georgia", 150);
		fHeader = p.createFont("Georgia", 50);
	}

	@Override
	public void registerUser(GestureManager manager, int userId) {
		// no gestures for this screen
	}

	@Override
	public void keyPressed() {
		if(DISABLE_CAMERA) {
			leave();
		}
	}
	
	@Override
	public void draw() {
		p.background(clBackground);

		int clPlay = p.color(clForeground);

		p.fill(clForeground); // text: LOGICO
		p.textFont(fBanner);
		p.text("LOGICO", p.width / 2 - p.textWidth("LOGICO") / 2,
				p.height / 2 - 100);

		p.fill(clPlay); // text: PLAY
		p.textFont(fHeader);
		p.text("Play", p.width / 2 - p.textWidth("Play") / 2,
				p.height / 2 + 100);

		p.fill(clPlay); // play button
		p.ellipse(p.width / 2, p.height / 2, 100, 100);
		p.fill(clBackground);
		p.triangle(p.width / 2 - 20, p.height / 2 + 25, p.width / 2 - 20,
				p.height / 2 - 25, p.width / 2 + 30, p.height / 2);
	}

	@Override
	public String returnValue() {
		return null;
	}

}
